package com.sean.example.activity;

import android.app.Activity;
import android.os.Bundle;

import com.sean.example.R;
import com.sean.example.databases.BaseDao;
import com.sean.example.databases.User;

public class Main extends Activity {
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
//        User user = new User();
//        user.setId(1);
//        user.setUserName("UserName");
//        user.setPassword("password");
//        DaoHelper baseDao = new DaoHelper(this);
//        baseDao.save(user);
//        User u = (User)baseDao.get(User.class, 1);
//        if(u != null) {
//        	System.out.println("Name :" + u.getUserName() + "; Password : " + u.getPassword());
//        }
        
        User user = new User();
        user.setId(2);
        user.setUserName("Shu");
        user.setPassword("Zhang");
        BaseDao<User> userDao = new BaseDao<User>(this, User.class);
        userDao.save(user);
        User u = userDao.get(2);
        if(u != null) {
        	System.out.println("Name :" + u.getUserName() + "; Password : " + u.getPassword());
        }
    }
}